package com.wanmait.meteor.config;

import com.wanmait.meteor.interceptor.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private JWTInterceptor jwtInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //registry.addInterceptor(jwtInterceptor).addPathPatterns("/manage/**").excludePathPatterns("/manage/login");
        //如果不排除可以在login方法上加@TokenIgnore注解
        registry.addInterceptor(jwtInterceptor).addPathPatterns("/manage/**");
    }
    //图片存放路径
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //registry.addResourceHandler("/uploadImages/**").addResourceLocations("file:D:/uploadImages/");
       registry.addResourceHandler("/images/**").addResourceLocations("classpath:/static/images/");
      //  registry.addResourceHandler("/images/**").addResourceLocations("classpath:/static/manageWeb/images/");

    }
}
//resources/static/manageWeb/images/
